#pragma once

#include <algorithm/analytical_model/algorithm/cuda/inter_op/Data.h>
#include <utils/config.h>

#include <string_view>
#include <tuple>

namespace solar::cuda::inter_op
{
    class RectangleHeliostat;
    class Receiver;
} // namespace solar::cuda::inter_op

namespace solar
{
    struct AnalyticalPipelineParam;
    enum class GeometryType;

    /// @brief 运行解析模型
    /// @param params 解析模型参数
    /// @note 需要手动在外部同步cudaStream
    /// @return ( 整个镜场的Flux分布（on device）, Flux分布的分辨率(x, y) )
    auto runAnalyticalModelPipeline(FUNC_CONST_INPUT AnalyticalPipelineParam* params,
                                    cudaStream_t stream = nullptr)
        -> std::tuple<float*, cuda::inter_op::Int2>;

    auto saveFluxMap(const std::string_view& file_name, float* data, int height, int width,
                     int precision = 2, int rows_package = 10) -> float;

    auto getFocusCenters(GeometryType receiver_type, const cuda::inter_op::Float3& receiver_size,
                         const cuda::inter_op::Float3& receiver_pos,
                         const cuda::inter_op::Float3& current_focus_center,
                         const cuda::inter_op::Float3* d_helio_pos,
                         const cuda::inter_op::Float3* d_focus_centers, std::size_t helio_count,
                         cudaStream_t stream = nullptr) -> void;

} // namespace solar
